#include <future>
#include <thread>
#include <memory>

#include <iostream>

int Add(int num1, int num2)
{
    return num1 + num2;
}

int main()
{
    auto ptask = std::make_shared<std::packaged_task<int(int, int)>>(Add);
    std::future<int> fu = ptask->get_future();
    std::thread th([ptask](){
        (*ptask)(11, 22);
    });
    int sum = fu.get();
    std::cout << sum << std::endl;
    th.join();
    return 0;
}